Discrete-time Markov chain

From HandWiki
Short description: Probability concept
A Markov chain with two states, A and E.

In probability, a discrete-time Markov chain (DTMC) is a sequence of random variables, known as a stochastic process, in which the value of the next variable depends only on the value of the current variable, and not any variables in the past. For instance, a machine may have two states, A and E. When it is in state A, there is a 40% chance of it moving to state E and a 60% chance of it remaining in state A. When it is in state E, there is a 70% chance of it moving to A and a 30% chance of it staying in E. The sequence of states of the machine is a Markov chain. If we denote the chain by [math]\displaystyle{ X_0, X_1, X_2, ... }[/math] then [math]\displaystyle{ X_0 }[/math] is the state which the machine starts in and [math]\displaystyle{ X_{10} }[/math] is the random variable describing its state after 10 transitions. The process continues forever, indexed by the natural numbers.

An example of a stochastic process which is not a Markov chain is the model of a machine which has states A and E and moves to A from either state with 50% chance if it has ever visited A before, and 20% chance if it has never visited A before (leaving a 50% or 80% chance that the machine moves to E). This is because the behavior of the machine depends on the whole history—if the machine is in E, it may have a 50% or 20% chance of moving to A, depending on its past values. Hence, it does not have the Markov property.

A Markov chain can be described by a stochastic matrix, which lists the probabilities of moving to each state from any individual state. From this matrix, the probability of being in a particular state n steps in the future can be calculated. A Markov chain's state space can be partitioned into communicating classes that describe which states are reachable from each other (in one transition or in many). Each state can be described as transient or recurrent, depending on the probability of the chain ever returning to that state. Markov chains can have properties including periodicity, reversibility and stationarity. A continuous-time Markov chain is like a discrete-time Markov chain, but it moves states continuously through time rather than as discrete time steps. Other stochastic processes can satisfy the Markov property, the property that past behavior does not affect the process, only the present state.

Definition

A discrete-time Markov chain is a sequence of random variables [math]\displaystyle{ X_0, X_1, X_2, ... }[/math] with the Markov property, namely that the probability of moving to the next state depends only on the present state and not on the previous states:

[math]\displaystyle{ \Pr(X_{n+1}=x\mid X_1=x_1, X_2=x_2, \ldots, X_n=x_n) = \Pr(X_{n+1}=x\mid X_n=x_n), }[/math] if both conditional probabilities are well defined, that is, if [math]\displaystyle{ \Pr(X_1=x_1,\ldots,X_n=x_n)\gt 0. }[/math]

The possible values of Xi form a countable set S called the state space of the chain.[1]

Markov chains are often described by a sequence of directed graphs, where the edges of graph n are labeled by the probabilities of going from one state at time n to the other states at time n + 1, [math]\displaystyle{ \Pr(X_{n+1}=x\mid X_n=x_n). }[/math] The same information is represented by the transition matrix from time n to time n + 1. However, Markov chains are frequently assumed to be time-homogeneous (see variations below), in which case the graph and matrix are independent of n and are thus not presented as sequences.

These descriptions highlight the structure of the Markov chain that is independent of the initial distribution [math]\displaystyle{ \Pr(X_1=x_1). }[/math] When time-homogeneous, the chain can be interpreted as a state machine assigning a probability of hopping from each vertex or state to an adjacent one. The probability [math]\displaystyle{ \Pr(X_n=x\mid X_1=x_1) }[/math] of the machine's state can be analyzed as the statistical behavior of the machine with an element [math]\displaystyle{ x_1 }[/math] of the state space as input, or as the behavior of the machine with the initial distribution [math]\displaystyle{ \Pr(X_1=y)=[x_1=y] }[/math] of states as input, where [math]\displaystyle{ [P] }[/math] is the Iverson bracket.[citation needed]

Variations

  • Time-homogeneous Markov chains (or stationary Markov chains) are processes where
[math]\displaystyle{ \Pr(X_{n+1}=x\mid X_n=y) = \Pr(X_n=x\mid X_{n-1}=y) }[/math]
for all n. The probability of the transition is independent of n.[1]
  • A Markov chain with memory (or a Markov chain of order m)
where m is finite, is a process satisfying
[math]\displaystyle{ \begin{align} &\Pr(X_n=x_n\mid X_{n-1}=x_{n-1}, X_{n-2}=x_{n-2}, \dots , X_1=x_1) \\ = {} &\Pr(X_n=x_n\mid X_{n-1}=x_{n-1}, X_{n-2}=x_{n-2}, \dots, X_{n-m}=x_{n-m}) \text{ for }n \gt m \end{align} }[/math]
In other words, the future state depends on the past m states. It is possible to construct a chain [math]\displaystyle{ (Y_n) }[/math] from [math]\displaystyle{ (X_n) }[/math] which has the 'classical' Markov property by taking as state space the ordered m-tuples of X values, ie. [math]\displaystyle{ Y_n= \left( X_n,X_{n-1},\ldots,X_{n-m+1} \right) }[/math].[citation needed]

n-step transitions

The probability of going from state i to state j in n time steps is

[math]\displaystyle{ p_{ij}^{(n)} = \Pr(X_n=j\mid X_0=i) }[/math]

and the single-step transition is

[math]\displaystyle{ p_{ij} = \Pr(X_1=j\mid X_0=i). }[/math]

For a time-homogeneous Markov chain:

[math]\displaystyle{ p_{ij}^{(n)} = \Pr(X_{k+n}=j \mid X_{k}=i) }[/math]

and

[math]\displaystyle{ p_{ij} = \Pr(X_{k+1}=j \mid X_k=i). }[/math]

The n-step transition probabilities satisfy the Chapman–Kolmogorov equation, that for any k such that 0 < k < n,

[math]\displaystyle{ p_{ij}^{(n)} = \sum_{r \in S} p_{ir}^{(k)} p_{rj}^{(n-k)} }[/math]

where S is the state space of the Markov chain.[1]

The marginal distribution Pr(Xn = x) is the distribution over states at time n. The initial distribution is Pr(X0 = x). The evolution of the process through one time step is described by

[math]\displaystyle{ \Pr(X_n=j) = \sum_{r \in S} p_{rj} \Pr(X_{n-1}=r) = \sum_{r \in S} p_{rj}^{(n)} \Pr(X_0=r). }[/math]

(The superscript (n) is an index, and not an exponent).

Communicating classes and properties

A state j is said to be accessible from a state i (written i → j) if a system started in state i has a non-zero probability of transitioning into state j at some point. Formally, state j is accessible from state i if there exists an integer nij ≥ 0 such that

[math]\displaystyle{ \Pr(X_{n_{ij}}=j \mid X_0=i) = p_{ij}^{(n_{ij})} \gt 0. }[/math]

A state i is said to communicate with state j (written i ↔ j) if both i → j and j → i. A communicating class is a maximal set of states C such that every pair of states in C communicates with each other. Communication is an equivalence relation, and communicating classes are the equivalence classes of this relation.[1]

A communicating class is closed if the probability of leaving the class is zero, namely if i is in C but j is not, then j is not accessible from i.[1] The set of communicating classes forms a directed, acyclic graph by inheriting the arrows from the original state space. A communicating class is closed if and only if it has no outgoing arrows in this graph.

A state i is said to be essential or final if for all j such that i → j it is also true that j → i. A state i is inessential if it is not essential.[2] A state is final if and only if its communicating class is closed.

A Markov chain is said to be irreducible if its state space is a single communicating class; in other words, if it is possible to get to any state from any state.[1][3]

Periodicity

A state [math]\displaystyle{ i }[/math] has period [math]\displaystyle{ k }[/math] if any return to state [math]\displaystyle{ i }[/math] must occur in multiples of [math]\displaystyle{ k }[/math] time steps. Formally, the period of state [math]\displaystyle{ i }[/math] is defined as

[math]\displaystyle{ k = \gcd\{ n \gt 0: \Pr(X_n = i \mid X_0 = i) \gt 0\} }[/math]

(where [math]\displaystyle{ \gcd }[/math] is the greatest common divisor) provided that this set is not empty. Otherwise the period is not defined.[1] Note that even though a state has period [math]\displaystyle{ k }[/math], it may not be possible to reach the state in [math]\displaystyle{ k }[/math] steps. For example, suppose it is possible to return to the state in [math]\displaystyle{ \{6,~8,~10,~12,\dots\} }[/math] time steps; [math]\displaystyle{ k }[/math] would be [math]\displaystyle{ 2 }[/math], even though [math]\displaystyle{ 2 }[/math] does not appear in this list.

If [math]\displaystyle{ k = 1 }[/math], then the state is said to be aperiodic. Otherwise ([math]\displaystyle{ k \gt 1 }[/math]), the state is said to be periodic with period [math]\displaystyle{ k }[/math]. Periodicity is a class property—that is, if a state has period [math]\displaystyle{ k }[/math] then every state in its communicating class has period [math]\displaystyle{ k }[/math].[1]

Transience and recurrence

A state i is said to be transient if, given that we start in state i, there is a non-zero probability that we will never return to i. Formally, let the random variable Ti be the first return time to state i (the "hitting time"):

[math]\displaystyle{ T_i = \inf \{ n\ge1: X_n = i\}. }[/math]

The number

[math]\displaystyle{ f_{ii}^{(n)} = \Pr(T_i = n \mid X_0 = i) }[/math]

is the probability that we return to state i for the first time after n steps. Therefore, state i is transient if

[math]\displaystyle{ \Pr(T_i \lt \infty \mid X_0 = i) = \sum_{n=1}^\infty f_{ii}^{(n)} \lt 1. }[/math]

State i is recurrent (or persistent) if it is not transient. Recurrence and transience are class properties, that is, they either hold or do not hold equally for all members of a communicating class.[1]

A state i is recurrent if and only if the expected number of visits to i is infinite:[1]

[math]\displaystyle{ \sum_{n=0}^\infty p_{ii}^{(n)} = \infty. }[/math]

Positive recurrence

Even if the hitting time is finite with probability 1, it need not have a finite expectation. The mean recurrence time at state i is the expected return time Mi:

[math]\displaystyle{ M_i = E[T_i]=\sum_{n=1}^\infty n\cdot f_{ii}^{(n)}. }[/math]

State i is positive recurrent (or non-null persistent) if Mi is finite; otherwise, state i is null recurrent (or null persistent). Positive and null recurrence are classes properties.[1]

Absorbing states

A state i is called absorbing if it is impossible to leave this state. Therefore, the state i is absorbing if and only if

[math]\displaystyle{ p_{ii} = 1\text{ and }p_{ij} = 0\text{ for }i \not= j. }[/math]

If every state can reach an absorbing state, then the Markov chain is an absorbing Markov chain.[3]

Reversible Markov chain

A Markov chain is said to be reversible if there is a probability distribution π over its states such that

[math]\displaystyle{ \pi_i \Pr(X_{n+1} = j \mid X_{n} = i) = \pi_j \Pr(X_{n+1} = i \mid X_{n} = j) }[/math]

for all times n and all states i and j. This condition is known as the detailed balance condition (or local balance equation).

Considering a fixed arbitrary time n and using the shorthand

[math]\displaystyle{ p_{ij} = \Pr(X_{n+1} = j \mid X_n = i)\,, }[/math]

the detailed balance equation can be written more compactly as

[math]\displaystyle{ \pi_i p_{ij} = \pi_j p_{ji}\,. }[/math][1]

The single time-step from n to n + 1 can be thought of as each person i having πi dollars initially and paying each person j a fraction pij of it. The detailed balance condition states that upon each payment, the other person pays exactly the same amount of money back.[4] Clearly the total amount of money π each person has remains the same after the time-step, since every dollar spent is balanced by a corresponding dollar received. This can be shown more formally by the equality

[math]\displaystyle{ \sum_i \pi_i p_{ij} = \sum_i \pi_j p_{ji} = \pi_j \sum_i p_{ji} = \pi_j\,, }[/math]

which essentially states that the total amount of money person j receives (including from himself) during the time-step equals the amount of money he pays others, which equals all the money he initially had because it was assumed that all money is spent (that is, pji sums to 1 over i). The assumption is a technical one, because the money not really used is simply thought of as being paid from person j to himself (that is, pjj is not necessarily zero).

As n was arbitrary, this reasoning holds for any n, and therefore for reversible Markov chains π is always a steady-state distribution of Pr(Xn+1 = j | Xn = i) for every n.

If the Markov chain begins in the steady-state distribution, that is, if [math]\displaystyle{ \Pr(X_0=i)=\pi_i }[/math], then [math]\displaystyle{ \Pr(X_n=i)=\pi_i }[/math] for all [math]\displaystyle{ n }[/math] and the detailed balance equation can be written as

[math]\displaystyle{ \Pr(X_{n} = i, X_{n+1} = j) = \Pr(X_{n+1} = i, X_{n} = j)\,. }[/math]

The left- and right-hand sides of this last equation are identical except for a reversing of the time indices n and n + 1.

Kolmogorov's criterion gives a necessary and sufficient condition for a Markov chain to be reversible directly from the transition matrix probabilities. The criterion requires that the products of probabilities around every closed loop are the same in both directions around the loop.

Reversible Markov chains are common in Markov chain Monte Carlo (MCMC) approaches because the detailed balance equation for a desired distribution π necessarily implies that the Markov chain has been constructed so that π is a steady-state distribution. Even with time-inhomogeneous Markov chains, where multiple transition matrices are used, if each such transition matrix exhibits detailed balance with the desired π distribution, this necessarily implies that π is a steady-state distribution of the Markov chain.

Closest reversible Markov chain

For any time-homogeneous Markov chain given by a transition matrix [math]\displaystyle{ P \in \mathbb{R}^{n \times n} }[/math], any norm [math]\displaystyle{ ||\cdot || }[/math] on [math]\displaystyle{ \mathbb{R}^{n \times n} }[/math] which is induced by a scalar product, and any probability vector [math]\displaystyle{ \pi }[/math], there exists a unique transition matrix [math]\displaystyle{ P^* }[/math] which is reversible according to [math]\displaystyle{ \pi }[/math] and which is closest to [math]\displaystyle{ P }[/math] according to the norm [math]\displaystyle{ ||\cdot ||. }[/math] The matrix [math]\displaystyle{ P^* }[/math] can be computed by solving a quadratic-convex optimization problem.[5]

For example, consider the following Markov chain:

Simple Markov chain.

This Markov chain is not reversible. According to the Frobenius Norm the closest reversible Markov chain according to [math]\displaystyle{ \pi = \left(\frac{1}{3},\frac{1}{3},\frac{1}{3}\right) }[/math] can be computed as

Mchain simple corrected C1.png

If we choose the probability vector randomly as [math]\displaystyle{ \pi=\left( \frac{1}{4}, \frac{1}{4}, \frac{1}{2} \right) }[/math], then the closest reversible Markov chain according to the Frobenius norm is approximately given by

Mvchain approx C2.png

Stationary distributions

A distribution [math]\displaystyle{ \pi }[/math] is a stationary distribution of the Markov chain with stochastic matrix [math]\displaystyle{ P }[/math] if and only if [math]\displaystyle{ \pi P = \pi }[/math]. This can be written as:[1]

[math]\displaystyle{ \forall j\in \mathbb{S}: \sum_{i\in \mathbb{S}} \pi_i p_{ij} = \pi_j }[/math].

This condition implies that [math]\displaystyle{ \pi P^n=\pi }[/math] and hence if the Markov chain [math]\displaystyle{ (X_n, n\in \mathbb{N}) }[/math] has initial distribution [math]\displaystyle{ X_0 = \pi }[/math] then [math]\displaystyle{ X_n = \pi }[/math] (in distribution) for any [math]\displaystyle{ n\in\mathbb{N} }[/math].[1]

If a Markov chain is irreducible then it has a stationary distribution if and only if it is positive recurrent,[6] in which case the unique such distribution is given by [math]\displaystyle{ \pi_i=\frac{1}{M_i} }[/math] where [math]\displaystyle{ M_i=\mathbb{E}(T_i) }[/math] is the mean recurrence time of i.[1]

If a chain has more than one closed communicating class, its stationary distributions will not be unique (consider any closed communicating class [math]\displaystyle{ C_i }[/math] in the chain; each one will have its own unique stationary distribution [math]\displaystyle{ \pi_i }[/math]. Extending these distributions to the overall chain, setting all values to zero outside the communication class, yields that the set of invariant measures of the original chain is the set of all convex combinations of the [math]\displaystyle{ \pi_i }[/math]'s). However, if a state j is aperiodic, then [math]\displaystyle{ \lim\nolimits_{n \rightarrow \infty} p_{jj}^{(n)} = \tfrac{C}{M_j} }[/math] and for any other state i, let fij be the probability that the chain ever visits state j if it starts at i, [math]\displaystyle{ \lim\nolimits_{n \rightarrow\infty} p_{ij}^{(n)} = C \tfrac{f_{ij}}{M_j}. }[/math]

If a state i is periodic with period k > 1 then the limit [math]\displaystyle{ \lim\nolimits_{n \rightarrow \infty} p_{ii}^{(n)} }[/math] does not exist, although the limit [math]\displaystyle{ \lim\nolimits_{n \rightarrow \infty} p_{ii}^{(kn+r)} }[/math] does exist for every integer r.

Steady-state analysis and the time-inhomogeneous Markov chain

A Markov chain need not necessarily be time-homogeneous to have an equilibrium distribution. If there is a probability distribution over states [math]\displaystyle{ \boldsymbol{\pi} }[/math] such that

[math]\displaystyle{ \pi_j = \sum_{i \in S} \pi_i \, \Pr(X_{n+1} = j \mid X_n = i) }[/math]

for every state j and every time n then [math]\displaystyle{ \boldsymbol{\pi} }[/math] is an equilibrium distribution of the Markov chain. Such can occur in Markov chain Monte Carlo (MCMC) methods in situations where a number of different transition matrices are used, because each is efficient for a particular kind of mixing, but each matrix respects a shared equilibrium distribution.

Hitting times

Expected hitting times

For a subset of states A ⊆ S, the vector kA of hitting times (where element [math]\displaystyle{ k_i^A }[/math] represents the expected value, starting in state i that the chain enters one of the states in the set A) is the minimal non-negative solution to[7]

[math]\displaystyle{ \begin{align} k_i^A = 0 & \text{ for } i \in A\\ -\sum_{j \in S} q_{ij} k_j^A = 1&\text{ for } i \notin A. \end{align} }[/math]

Ergodic theorem

An instance of ergodic theory, the ergodic theorem for states that for an irreducible aperiodic Markov chain, for any two states i and j,[1]

[math]\displaystyle{ p_{i,j}^{(n)}\rightarrow \frac{1}{M_j} }[/math] as [math]\displaystyle{ n\rightarrow \infty }[/math].

Notes

  1. 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 Grimmett, G. R.; Stirzaker, D. R. (1992). "6". Probability and Random Processes (second ed.). Oxford University Press. ISBN 0198572220. 
  2. Asher Levin, David (2009). Markov chains and mixing times. p. 16. ISBN 978-0-8218-4739-8. 
  3. 3.0 3.1 Gagniuc, Paul A. (2017). Markov Chains: From Theory to Implementation and Experimentation. USA, NJ: John Wiley & Sons. pp. 1–235. ISBN 978-1-119-38755-8. 
  4. Richard Durrett (19 May 2012). Essentials of Stochastic Processes. Springer Science & Business Media. p. 37. ISBN 978-1-4614-3615-7. https://books.google.com/books?id=i_Ovy6OvI54C&pg=PA37. 
  5. A. Nielsen, M. Weber. Online publication in Numerical Linear Algebra with Applications, DOI:10.1002/nla.1967, 2015.
  6. Serfozo, Richard (2009), "Basics of Applied Stochastic Processes", Probability and Its Applications: 35, doi:10.1007/978-3-540-89332-5, ISBN 978-3-540-89331-8, https://books.google.com/books?id=JBBRiuxTN0QC&pg=PA35 
  7. Norris, J. R. (1997). "Continuous-time Markov chains II". Markov Chains. pp. 108–127. doi:10.1017/CBO9780511810633.005. ISBN 9780511810633. 

References

  • A. A. Markov (1971). "Extension of the limit theorems of probability theory to a sum of variables connected in a chain". reprinted in Appendix B of: R. Howard. Dynamic Probabilistic Systems, volume 1: Markov Chains. John Wiley and Sons.
  • Markov, A. A. (2006). "An Example of Statistical Investigation of the Text Eugene Onegin Concerning the Connection of Samples in Chains". Science in Context 19 (4): 591–600. doi:10.1017/s0269889706001074. 
  • Leo Breiman (1992) [1968] Probability. Original edition published by Addison-Wesley; reprinted by Society for Industrial and Applied Mathematics ISBN:0-89871-296-3. (See Chapter 7)
  • J. L. Doob (1953) Stochastic Processes. New York: John Wiley and Sons ISBN:0-471-52369-0.
  • S. P. Meyn and R. L. Tweedie (1993) Markov Chains and Stochastic Stability. London: Springer-Verlag ISBN:0-387-19832-6. online: MCSS . Second edition to appear, Cambridge University Press, 2009.
  • Kemeny, John G.; Hazleton Mirkil; J. Laurie Snell; Gerald L. Thompson (1959). Finite Mathematical Structures (1st ed.). Englewood Cliffs, NJ: Prentice-Hall, Inc.. Library of Congress Card Catalog Number 59-12841. https://archive.org/details/finitemathematic0000keme_h5g0.  Classical text. cf Chapter 6 Finite Markov Chains pp. 384ff.
  • John G. Kemeny & J. Laurie Snell (1960) Finite Markov Chains, D. van Nostrand Company ISBN:0-442-04328-7
  • E. Nummelin. "General irreducible Markov chains and non-negative operators". Cambridge University Press, 1984, 2004. ISBN:0-521-60494-X
  • Seneta, E. Non-negative matrices and Markov chains. 2nd rev. ed., 1981, XVI, 288 p., Softcover Springer Series in Statistics. (Originally published by Allen & Unwin Ltd., London, 1973) ISBN:978-0-387-29765-1

zh-yue:離散時間馬可夫鏈